import React from "react"

import InputBox from "./com/inputbox"
import TodoBoard from "./com/todoboard"

class App extends React.Component{
  constructor(props){
    super(props)
    //定义todo的状态
    this.state={
      todo:{}
    }
  }

//定义回调函数
addTodo=(todo)=>{
  console.log(todo);
          
    //修改状态只能使用setstate函数
    this.setState({
      todo:todo
    })
}



  render(){
    return(
      <div>
        <InputBox addTodo={this.addTodo}></InputBox>
        <TodoBoard todo={this.state.todo}></TodoBoard>
      </div>
    )
  }
 
}

export default App;
